#!/bin/sh
source /etc/profile
pname='euxrtb.jar'
echo "restart to deploy xrtb.jar"
projectdir=/opt/adn-xrtb/
pno=0
for i in `ps -ef | grep  euxrtb.jar  |grep -v auto |grep -v grep | grep java | awk '{print $2}'`
do
  echo $i
  pno=$i
  #kill $i
  #sleep 3
done
echo $pno

if test $pno -eq 0
then
    echo 'stoping'
    datetime=`date +%Y%m%d%H%M%S`
    echo $datetime
    cd  $projectdir
    sh /opt/xrtb/starteu.sh
    echo "xrtb service is restart..."
else
    echo 'running'
fi
